<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north'" class="center">
        <div class="webmap">
            <p class="webmaptip">当前位置:</p>
            <a href="javascript:;" class="easyui-link" data-options="plain:true">财务管理</a>
            <p class="webmaptip">></p>
            <a href="javascript:;" class="easyui-link" data-options="plain:true">提现记录</a>
        </div>
        <div class="querybycon">
            <form id="query">
                <div class="queryinfo">

                    <div>交易单号<input type="text" name="tradeNo"></div>
                    <div>用户名<input type="text" name="user.telephone"></div>
                    <div>状态 <input class="easyui-combobox" name="state"
                                   data-options="url:'/dictionary/tradingState?all=true'"></div>
                    <div class="db">申请时间 <input name="applyStartTime" class="easyui-datetimebox">
                        -
                        <input name="applyEndTime" class="easyui-datetimebox">
                    </div>

                    <div class="query">
                        <a id="querybtn" href="javascript:;" class="easyui-linkbutton"
                           data-options="iconCls:'fa fa-search'"></a>
                    </div>
                </div>
            </form>
        </div>
        <div class="querybtn">
            <a id="exportbtn" href="javascript:;" class="easyui-linkbutton  "
               data-options="iconCls:'fa fa-search'">导出</a>
            <!--<a id="add" href="javascript:;" class="easyui-linkbutton  warning" data-options="iconCls:'fa fa-plus'">添加</a>
            <a id="edit" href="javascript:;" class="easyui-linkbutton danger" data-options="iconCls:'fa fa-pencil'">编辑</a>
            <a id="del" href="javascript:;" class="easyui-linkbutton success" data-options="iconCls:'fa fa-remove'">删除</a>-->
        </div>
        <div class="separator"></div>
    </div>
    <div data-options="region:'center'" class="center">

        <table id="list"></table>
    </div>
</div>
<script type="text/javascript">
    /*var addUrl = "page/menu/menueadd.html";
     var editUrl = "/menu/menuedit.html";
     var delUrl = '/menu/del';
     var save = '/menu/save';*/
    var listUrl = "/record/list?type=2";
    var exportUrl = "/record/export";
    var columns = [[{
        field: 'id',
        checkbox: true
    }, {
        field: 'tradeNo',
        title: '交易单号',
    }, {
        field: 'telephone',
        title: '用户名',
        formatter: function (value, row, index) {
            if (row != null) {
                return row.user.telephone;
            }

        }
    }, {
        field: 'name',
        title: '姓名',
        formatter: function (value, row, index) {
            if (row != null) {
                return row.user.name;
            }

        }
    }, {
        field: 'amount',
        title: '提现金额(元)', formatter: function (value) {
            return formatNumber(value, 2);
        }
    }, {
        field: 'serviceCharge',
        title: '手续费(元)', formatter: function (value) {
            return formatNumber(value, 2);
        }
    }, {
        field: 'actualAmount',
        title: '到账金额(元)',
        formatter: function (value, row, index) {
            return formatNumber(value, 2);
        }
    }, {
        field: 'serviceChargeParty',
        title: '手续费支付方',
        formatter: function (value, row, index) {
            return dic["handingFeeType"][value];
        }
    }, {
        field: 'bankName',
        title: '所属银行',
        formatter: function (value, row, index) {
            if (row != null && row.recordProperty != null) {
                return row.recordProperty.bankName;
            } else {
                return '';
            }
        }
    }, {
        field: 'bankBranch',
        title: '开户行',
        formatter: function (value, row, index) {
            if (row != null && row.recordProperty != null) {
                return row.recordProperty.bankBranch;
            } else {
                return '';
            }
        }
    }, {
        field: 'bankCard',
        title: '银行卡号',
        formatter: function (value, row, index) {
            return '****' + value;
        }
    }, {
        field: 'createdDate',
        title: '申请时间',
    }, {
        field: 'state',
        title: '状态',
        formatter: function (value, row, index) {
            return dic["tradingState"][value];
        }
    }]];
    list.init({url: listUrl, columns: columns});

    $("#exportbtn").click(function () {
        var obj = $("#query").serializeObject();
        window.open(exportUrl + "?type=2&" + $(obj).formatJson2Url());
    });
    function formatNumber(value, fixed) {
        var number = Number(value);
        if (isNaN(number)) {
            return '';
        } else {
            return number.toFixed(2);
        }
    }
</script>
